﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using myschoolDal;

namespace school
{
    /// <summary>
    /// 
    /// </summary>
    public partial class addmanager : Form
    {
        private long ID;
        private string _Name;
        private string Pswd;
        public addmanager()
        {
            InitializeComponent();
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (name_textBox.Text == "" || ID_textBox.Text == "" || passwd_textBox.Text == "")
            {

                MessageBox.Show("错误：" + bug.Class1.worng4003 + " \n错误代码：Wrong4003", "提示");
                //return button1_Click(object sender, EventArgs e);

            }
            else
            {
                ID = Convert.ToInt64(ID_textBox.Text);
                _Name = name_textBox.Text.ToString();

                Pswd = passwd_textBox.Text.ToString();

                //当账号存在时
                if (manserver.CheckId(ID))
                {
                    MessageBox.Show("错误：" + bug.Class1.woring5001 + "\n错误代码：wrong5001", "提示");
                }
                else
                {
                    manserver.AddManInformation(ID, _Name, Pswd);
                }
            }
        }
    }
}
